//
//  main.swift
//  swift的基础语法
//
//  Created by lanou on 16/10/27.
//  Copyright (c) 2016年 lanou. All rights reserved.
//

import Foundation


let test = ClassTest()
print(test.name!)//可选类型的解包（去掉optional）
println(test.age)

let cat = Animal ()
cat.age = 20
cat.type = "cat"
println(cat.age)

let dog = Animal(age: 2, type: "dog" )
//键值对
dog.setValue("牧羊犬", forKey:"type")
//在进行键值对赋值的时候，类的属性如果是基本数据类型必须要赋初始值
//dog.setValue(5, forKey: "age")
println(dog.type!)
println(dog.age)

let student1 = Studet(name: "shuai", age:22, no:88)
println(student1.name!)
println(student1.no!)


let animal1 = Animal()
var dict:Dictionary<String,NSObject> = ["type":"monkey","age":12,]
println(dict)
animal1.setValuesForKeysWithDictionary(dict)
